//
//  PhotoLibPreviewViewController.h
//  XPhoto
//
//  Created by baboy on 2020/6/9.
//  Copyright © 2020 baboy. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "PhotoAssetPreviewViewController.h"

NS_ASSUME_NONNULL_BEGIN
@protocol PhotoLibPreviewDelegate;

@interface PhotoLibPreviewViewController : PhotoAssetPreviewViewController
@property(nonatomic, assign) NSInteger photoCount;

@property(nonatomic, strong) PHFetchResult* photos;
@property(nonatomic, strong) IBOutlet UIScrollView *thumbListView;
@property(nonatomic, strong) NSMutableArray *selectedPhotos;
@property(nonatomic, strong) NSMutableArray *thumbItemViews;
@property(nonatomic, strong) IBOutlet UIView *topView;
@property(nonatomic, strong) IBOutlet UIView *bottomView;
@property(nonatomic, strong) IBOutlet UIButton *enterButton;
@property(nonatomic, strong) IBOutlet UIButton *checkboxButton;
@property(nonatomic, assign) IBOutlet id<PhotoLibPreviewDelegate> delegate;
@property(nonatomic, assign) NSInteger currentIndex;
@property(nonatomic, assign) BOOL showCheckbox;

- (void)addSelectedPhoto:(PHAsset *)photoAsset;
- (void)removeSelectedPhoto:(PHAsset *)photoAsset;
- (void)showAtIndex:(NSInteger)index;
- (IBAction)enter:(id)sender;
@end

@protocol PhotoLibPreviewDelegate <NSObject>

//- (void)photoLibPreviewViewControllerDidFinished:(PhotoLibPreviewViewController*)vc;
- (void)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc didFinishAtIndex:(NSInteger)index;

//- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc shouldSelectPhotoAtIndex:(NSInteger)index;
- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc shouldSelectAsset:(PHAsset *)asset;

//- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc selectPhotoAtIndex:(NSInteger)index;
- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc selectAsset:(PHAsset *)asset;
//- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc deselectPhotoAtIndex:(NSInteger)index;
- (BOOL)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc deselectAsset:(PHAsset *)asset;

//- (PHAsset *)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc loadPhotoAtIndex:(NSInteger)index;
//- (NSInteger)photoLibPreviewViewController:(PhotoLibPreviewViewController*)vc indexOfPhoto:(PHAsset *)photoAsset;
@end
NS_ASSUME_NONNULL_END
